package networkTraining.inspection;

import neuralModel.neuron.INeuron;
import neuralModel.neuron.ISignal;

public class NeuronWeightInspector
{
	private INeuron neuron;
	private StringBuilder neuronWeightInfo;

	public NeuronWeightInspector(INeuron neuron)
	{
		this.neuron = neuron;
		neuronWeightInfo = new StringBuilder();
		initHeaders();
	}

	private void initHeaders()
	{
		neuronWeightInfo.append(String.format("Neuron: %s\n\n", neuron.getName()));

		for (ISignal signal : neuron.getInputSignalList())
		{
			neuronWeightInfo.append(String.format("%15s-Weight\t", signal.getSourceNeuron().getName()));
		}
		neuronWeightInfo.append("\n");

		for (ISignal signal : neuron.getInputSignalList())
		{
			neuronWeightInfo.append(String.format("%22f\t", signal.getWeight()));
		}
		neuronWeightInfo.append("\n");
	}

	public void takeSnapShot()
	{
		for (ISignal signal : neuron.getInputSignalList())
		{
			neuronWeightInfo.append(String.format("%22f\t", signal.getWeight()));
		}
		neuronWeightInfo.append("\n");
	}

	public String getInspectionInfo()
	{
		return neuronWeightInfo.toString();
	}

}
